/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "moeda", catalog = "salao", schema = "public")
public class Moeda implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "moeda_id_seq")
    @SequenceGenerator(name = "moeda_id_seq", sequenceName = "moeda_id_seq", initialValue = 1, allocationSize = 1)
    @Column(name = "id_moeda")
    @JoinColumn(name = "id_moeda",
    referencedColumnName = "id_moeda",
    nullable = false,
    insertable = true,
    updatable = false)
    private Integer id;
    @Column(name = "nom_moeda", length = 50)
    private String nomMoeda;
    @Column(name = "sigla", length = 20)
    private String sigla;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "cotacao", nullable = false, precision = 18, scale = 2)
    private BigDecimal cotacao;
    @Basic(optional = false)
    @Column(name = "data_cotacao", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dataCotacao;

    public Moeda() {
    }

    public Moeda(Integer id) {
        this.id = id;
    }

    public Moeda(Integer id, BigDecimal cotacao) {
        this.id = id;
        this.cotacao = cotacao;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNomMoeda() {
        return nomMoeda;
    }

    public void setNomMoeda(String nomMoeda) {
        this.nomMoeda = nomMoeda;
    }

    public String getSigla() {
        return sigla;
    }

    public void setSigla(String sigla) {
        this.sigla = sigla;
    }

    public BigDecimal getCotacao() {
        return cotacao;
    }

    public void setCotacao(BigDecimal cotacao) {
        this.cotacao = cotacao;
    }

    public Date getDataCotacao() {
        return dataCotacao;
    }

    public void setDataCotacao(Date dataCotacao) {
        this.dataCotacao = dataCotacao;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Moeda)) {
            return false;
        }
        Moeda other = (Moeda) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.Moeda[id=" + id + "]";
    }
}
